import {Loading} from "element-ui";
import store from '@/store'

class LoadingUtil {
    constructor() {
        if (new.target !== LoadingUtil) {
            return
        }
        if (!LoadingUtil._instance) {
            this._loading = null
            LoadingUtil._instance = this
        }
        return LoadingUtil._instance
    }

    loading() {
        store.dispatch('app/setSpinner', 1)
        /*this._loading = Loading.service({
            fullscreen: true,
            lock: true,
            text: '加载中.....'
        })*/
    }

    close() {
        store.dispatch('app/setSpinner', -1)

        /*if (this._loading) {
            this._loading.close()
        }*/
    }
}

const loadingUtil = new LoadingUtil();
export default loadingUtil